﻿using System;
using System.Collections.Generic;
using System.Linq;
using Luna.Data;
using Luna.Data.Configuration;
using Luna.Data.CRM;

namespace Luna.Connectors.ZohoCRM
{
    public class ZohoCRMContactProvider : LunaDataProvider
    {
        public ZohoCRMContactProvider()
        {
        }

        public ZohoCRMSettingsManager Manager { get; set; }

        public void AccountDelete(IReferenceData P_AccountID)
        {
            throw new NotImplementedException();
        }

        public void AccountDelete(IEnumerable<IAccountData> P_Accounts)
        {
            throw new NotImplementedException();
        }

        public IAccountData AccountGet(IReferenceData P_AccountID)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<IAccountData> AccountGetAll()
        {
            throw new NotImplementedException();
        }

        public void AccountSave(IAccountData P_Account)
        {
            throw new NotImplementedException();
        }

        public void AccountSave(IEnumerable<IAccountData> P_Accounts)
        {
            throw new NotImplementedException();
        }

        public void CategoryDelete(IReferenceData P_CategoryID)
        {
            throw new NotImplementedException();
        }

        public ICategoryData CategoryGet(IReferenceData P_CategoryID)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<ICategoryData> CategoryGetAll()
        {
            throw new NotImplementedException();
        }

        public void CategorySave(ICategoryData P_Category)
        {
            throw new NotImplementedException();
        }

        public void ContactDelete(IReferenceData P_Contact)
        {
            throw new NotImplementedException();
        }

        public void ContactDelete(IEnumerable<IContactData> P_Contact)
        {
            throw new NotImplementedException();
        }

        public IContactData ContactGet(IReferenceData P_ContactID)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<IContactData> ContactGetAll()
        {
            throw new NotImplementedException();
        }

        public void ContactSave(IContactData P_Contact)
        {
            throw new NotImplementedException();
        }

        public void ContactSave(IEnumerable<IContactData> P_Contacts)
        {
            throw new NotImplementedException();
        }

        public string Test(IZohoCRMSettings P_Data)
        {
            try
            {
                var L_Client = Manager.TestQuery(P_Data);
                ListOptions L_Options = new ListOptions();
                L_Options.FromIndex = 0;
                L_Options.ToIndex = 1;
                var L_Feed = L_Client.GetRecords<ZohoAccount>(L_Options);
                L_Feed.Count();
                return string.Empty;
            }
            catch (Exception L_Return)
            {
                Log.Error(L_Return.Message, L_Return);
                return L_Return.Message;
            }
        }

        public void CategoryDelete(Guid categoryID)
        {
            throw new NotImplementedException();
        }
    }
}